{% extends 'base.html' %}
{% load markup %}
{% load textformat %}
{% block title %}{{ post.title }}{% endblock %}
{% block meta %}
<meta name="keyword" content="{{ post.tags}}" />
{% endblock %}
{% block content %}
<table border="0" cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <td valign="middle">
            <h1 style="margin-bottom: 0px;"><a href="/post/{{post.key.id}}">[{{ post.category.name }}] {{ post.title }} {% if post.is_published %}{%else%}(未发布){%endif%}</a></h1>
            <p style="padding:0px; margin: 0px;" class="small_font">
                类别: <a href="/category/{{ post.category.key.id }}/">{{ post.category.name }} </a>
                <span style="padding-left: 10px;">
                    {{ post.author.nickname }}写于{{ post.create_time|date:"Y-M-d H:i" }}
                </span>
            </p>
        </td>
    </tr>
</table>
<div style="margin-left: 20px;">
    {{ post.content|markdown }}
</div>
<div class="post_footer" style="margin-top: 30px;">
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
        <tr>
            <td align="right" class="small_font">
                {% if is_admin %}<a href="/post/{{post.key.id}}/delete/">删除</a>
                {% endif %}
                {% if is_admin %}<a href="/post/{{ post.key.id }}/edit/">修改</a>
                {% endif %} 
                <span>
                    阅读({{ post.read_count }})
                </span>
            </td>
        </tr>
    </table>
</div>
<div>
    <p>
        <a name="comment"><b>共{{ post.comment_count }}条评论 (您的意见对我们很重要，请留下您的评论。)</b></a>
    </p>
    {% for comment in comments %}
    <p>
        {{ comment.author.nickname }} 于 {{ comment.create_time|timesince }}前 评论道:
    </p>
    <div style="background-color: #e1f1ff; padding: 10px 10px 10px 30px; margin-bottom: 30px;">
        {{ comment.content|plaintext2html }}
    </div>
    {% endfor %}
    <br/>
    {% if user.is_authenticated %}
    <form method="post" action="">
        <textarea rows="10" name="comment" style="width:90%;"></textarea>
        <p>
            <input type="submit" value="提交">
        </p>
    </form>
    {% else %}
    请<a href="/login?next=/post/{{post.key.id}}">用Google帐号登录</a>发表你的评论。
    {% endif %}
</div>
{% endblock %}
